
public class Column {
	int _numRows;
	int _numPieces;
	Tile[] _row;
	Column _left;
	Column _right;
	Board _board;
	
	Error addPiece(Player player) {
		if (_numPieces < _numRows) {
			_row[_numPieces].SetPlayer(player);
			_board._lastTile = _row[_numPieces];
			++_numPieces;
			return Error.SUCCESS;
		}
		return Error.COLUMN_NOT_ENOUGH_SPACE; // error not enough space
	}
	
	Error removeBottomPiece() {
		for (int r = 0; r <_numPieces-1; ++r) {
			_row[r].SetPlayer(_row[r+1].GetPlayer());
		}
		_row[_numPieces-1].SetPlayer(Player.NONE);
		--_numPieces;
		return Error.SUCCESS;
	}
	
	Error removeTopPiece() {
		if (_numPieces > 0) {
			_row[--_numPieces].SetPlayer(Player.NONE);
			return Error.SUCCESS;
		}
		return Error.COLUMN_NOT_ENOUGH_SPACE; // error not enough space
		
	}
	
	void flipPieces() {
		for (int r = 0; r < _numPieces/2; ++r) {
			Player temp = _row[_numPieces-r-1].GetPlayer();
			_row[_numPieces-r-1].SetPlayer(_row[r].GetPlayer());
			_row[r].SetPlayer(temp);
		}
	}
	
	boolean isFull() {
		if (_numPieces == _numRows) {
			return true;
		} else {
			return false;
		}
	}
}
